package com.google.code.coma.worker;

/**
 * This interface provides basic methods to deal with workers.
 *
 * @author Bernhard Nickel, e0925384@student.tuwien.ac.at
 * @author Dominik Strasser, dominikstr@gmail.com
 */
public interface Worker {
	/**
	 * Starts the worker
	 */
	public void startWork();

	/**
	 * Tells the worker to stop.
	 * Note: This method won't terminate the worker immediately as there might be open transactions or other blocking
	 * operations in process.
	 */
	public void stopWork();

	/**
	 * Returns the id of this worker. This id should be unique withing the whole application scope but keep in mind that
	 * the id generation implementation depends on the concreate worker.
	 *
	 * @return the worker id
	 */
	public String getWorkerId();

	/**
	 * Returns the state of the worker.
	 *
	 * @return true if the worker is active, false if the worker stopped working
	 */
	public boolean isActive();


	/**
	 * Returns the assigned factory id
	 *
	 * @return factory id
	 */
	public String getFactoryId();
}
